<template>
     <span class="mui-numbox">
        <button class="mui-btn mui-btn-numbox-minus" type="button" @click="delNum">-</button>
        <input class="mui-input-numbox" type="number" v-model="count">
        <button class="mui-btn mui-btn-numbox-plus" type="button" @click="addNum">+</button>
    </span>
</template>

<script type='es6'>
    export default {
        data(){
            return{
                count:1
            }
        },
        methods:{
            sendMes(){
                this.$emit("postNum",this.count)
            },
            addNum(){
                this.count++
                this.sendMes()
            },
            delNum(){
                this.count--
                if(this.count < 1){
                    this.count = 1
                }
                this.sendMes()
            }
        }
    }
</script>

<style scoped>

</style>  